export default {
    // 人事交接 - 折现时长
    discountLengthValidator: (record, rule, data, callback) => {
        const { dealType, discountingDurationUpperLimit, holidayCode, remainDuration } = record;
        if (!discountingDurationUpperLimit && dealType === 1) {
            callback('请输入折现时长');
        } else if (discountingDurationUpperLimit && dealType === 1) {
            if (
                discountingDurationUpperLimit >
                (remainDuration / (holidayCode === 'CommonYear' ? 8 * 60 : 60)).toFixed(2)
            ) {
                callback('折现时长超过上限');
            } else {
                callback();
            }
        } else {
            callback();
        }
    }
};
